home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14080 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: informatik.tu-muenchen.de!meisenec
  2. From: meisenec@informatik.tu-muenchen.de (Robert Meisenecker)
  3. Newsgroups: comp.lang.c++
  4. Subject: Question on template-probs
  5. Date: 28 Mar 1996 19:10:48 GMT
  6. Organization: Technische Universitaet Muenchen, Germany
  7. Distribution: world
  8. Message-ID: <4jeo7o$q00@sunsystem5.informatik.tu-muenchen.de>
  9. NNTP-Posting-Host: hphalle0a.informatik.tu-muenchen.de
  10. Originator: meisenec@hphalle0a.informatik.tu-muenchen.de
  11.  
  12.  
  13. Hi,
  14.  
  15. im an relatively unexperienced C++ programmer, which is the reason for this
  16. simple question (I bet it's simple for an more experienced programmer): i played
  17. around with templates and was confronted with the following problem: 
  18.  
  19. If I use the template by creating an object of a simple type like int, the linker
  20. states that all of the member functions of the template are unknown. This occurs
  21. only when the member functions are NOT coded inline. If the member functions are
  22. specified inline, then there is no problem with the linker. (Inline means here
  23. that the problem even occurs when the member functions are not specified as 
  24. part of the class declaration, but in a source file with the leading keyword
  25. "inline") 
  26.  
  27. My question is: how to avoid those linker problems without declaring all
  28. member functions as part of the class (becomes a bit confusing when the member
  29. fuctions are a bit longer...)
  30.  
  31. At first (as an experienced C-Programmer) I thougt of declaring Prototypes, 
  32. but as I found out C++ allows only exactly one prototype, and by the way: Isn't
  33. it the job of the compiler to create those prototypes if I create a template?
  34.  
  35. Maybe it's a special problem of my compiler: i'm working with the Watcom C/C++
  36. Compiler V.10.5.
  37.  
  38. I'd be glad if anyone could solve my problem.
  39.  
  40. Answers via PM to: meisenec@informatik.tu-muenchen.de
  41.  
  42. Thanks
  43.  
  44. Robert 
  45.  
  46.